# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=shadowsocks-libev
pkgver=3.3.5
pkgrel=4
pkgdesc="lightweight secured SOCKS5 proxy"
url="https://shadowsocks.org/en/download/servers.html"
arch="all !armhf !armv7 !x86" # blocked by libbloom
license="GPL-3.0-or-later"
makedepends="asciidoc autoconf automake libtool linux-headers libcorkipset-dev
	mbedtls2-dev pcre-dev xmlto libev-dev c-ares-dev libsodium-dev zlib-dev libbloom-dev"
subpackages="$pkgname-dev $pkgname-doc lib$pkgname:libs"
source="shadowsocks-libev-$pkgver.tar.gz::https://github.com/shadowsocks/shadowsocks-libev/archive/v$pkgver.tar.gz
	use-upstream-libcorkipset-libbloom.patch
	"

# secfixes:
#   3.3.4-r0:
#     - CVE-2019-5163
#     - CVE-2019-5164

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-shared \
		--enable-system-shared-lib
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
c0cc869b4b7661ebd348bd5559c6a17c44b66a5f42374d97023adcfb525d934da3ed96245ff792ebc74870d30dd8f71fadcd89c79b2cd8a98d551ff7592508d0  shadowsocks-libev-3.3.5.tar.gz
6e14365fb65731e4f9573b39dd7849d47392b39db52aeffee0e91ee767db2361b053f02bc96cc439e5b677d85c09cd44fd905d6b1fca8b10d2e650d8c41a16e0  use-upstream-libcorkipset-libbloom.patch
"
